VtText
Create a Text widget
Syntax
VtText object_name [options]
Description
Creates a Text object and returns the widget name. Text fields
display text in a box. The text is editable by default, but you can
make it read-only. You can create a single line of text, or multiple
lines. Text fields are useful for displaying text or for fields where
the user needs to enter a value.
Options
- -callback cmd (C)
- Sets the callback to call when a return key is pressed in a single-line
text widget.
Additional callback keys
- value
- contents of the text widget.
- -columns integer (CSG)
- Make the Text widget integer number of columns wide.
This means that integer characters are shown.
In the graphical environment this will make the
width of the object integer * Max_Charwidth wide.
- -filename string (CS)
- Specifies that the contents of the file named string
should be displayed in the Text widget.
- -horizontalScrollBar boolean (CS)
- Indicates whether to include a horizontal scrollbar.
The default value is FALSE. This option is ignored
in character mode.
- -losingFocusCallback cmd (C)
- Sets the command to call when the Text widget loses focus. This
routine is called regardless of whether the text has changed.
Additional callback keys
- value
- the contents of the Text widget.
- -noEcho (CS)
- Turns off echoing.
- -readOnly (CS)
- Disables editing of the Text widget.
- -rows integer (CSG)
- Specifies the number of character rows displayed in the Text widget.
- -value string (CSG)
- Specifies the contents of the Text widget.
- -valueChangedCallback cmd (CS)
- Specifies the command cmd to be called after text is
either inserted into or deleted from the Text widget.
Additional callback keys
- value
- the contents of the Text widget.
- -verticalScrollBar boolean (CS)
- This is a flag: set to TRUE for a vertical scroll bar,
otherwise FALSE. The default value is FALSE.
- -wordWrap (C)
- Enables word wrap.
Examples
The following code produces a Text widget of 67 columns and 8 rows
containing some illustrative text.
set app [VtOpen text]
set form [VtFormDialog $app.form -title "VtText Demo" ]
VtText $form.text -value "Kumquat\n\nFrom the Chinese \
'kam' meaning 'gold' and 'kwat' meaning 'orange'\n
A small citrus fruit with a sweet spongy rind and slightly
acidic pulp. Also used to refer to the trees and shrubs of the
rue family which bear kumquats." \
-columns 67 \
-rows 8
VtShow $form
VtMainLoop
This code produces the following:
See also:
The following editing keys are available in character mode:
- <Bksp>
- Backspace/delete.
- <Ctrl>B
- Backspace/delete.
- <Ctrl>D
- Move down a line.
- <Ctrl>E
- End of line/end of text.
- <Ctrl>I
- Tab.
- <Ctrl>J
- New line/return.
- <Ctrl>K
- Return/Tab.
- <Ctrl>L
- Move cursor right.
- <Ctrl>M
- Return.
- <Ctrl>T
- Start of line/top text.